package com.lmj.controller;

import com.lmj.dto.DataResponse;
import com.lmj.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {
    // @RestController注解下所有返回值都是JSON格式，且url参数格式会改

    @Autowired
    private UserService userService;

    @RequestMapping("/login")
    public DataResponse loginByPassword(@RequestBody String request) {
        return userService.loginByPassword(request);
    }

    // 获取当前用户信息
    @RequestMapping("user_info")
    public DataResponse getUserInfo(@RequestBody String request) {
        return userService.getUserInfo(request);
    }

}
